<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> 
<%@page import="com.solution.common.config.PublicConfig"%>
<%@page import="com.solution.admin.home.constants.IndexConstants"%>
<%
	String basePath = PublicConfig.ROOT_PATH;
	String imgRootURL = PublicConfig.IMG_ROOT_URL;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta content="zh-cn" http-equiv="content-language" />
<meta content="" name="copyright" />

<link rel="icon" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="bookmark" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=basePath %>/statics/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath %>/statics/css/public.css" />
<script charset="utf-8" language="javascript" type="text/javascript" src="<%=basePath %>/statics/js/jquery.1.11.3.min.js"></script>
<script type="text/javascript" src="<%=basePath %>/statics/js/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/plugins/layer/layer.js"></script>
<!--[if lte IE 6]> 
<script type="text/javascript" src="js/PNG.js"></script> 
<script> 
PNG.fix('*'); 
</script> 
<![endif]-->

<script type="text/javascript">
	//系统域名 
	var rootPath = '<%=basePath%>';
	// 系统上传文件展示域名
	var imgRootURL = '<%=imgRootURL%>';
	// 百度富文本框根路径
	window.UEDITOR_HOME_URL = rootPath + "/statics/plugins/ueditor/";

	$(function() {
		//当日是否允许签到
		$.ajax({
			type : "post",
			url :  rootPath + "/home/checkAllowSign",
			async : true,
			datatype : "json",
			success : function(json) {
				if (json.allowSign != 1) {
					$("#sign_li").remove();
				}
			}
		});
	});
</script>
</head>
<body>
	<c:set var="rootPath" value="<%=basePath %>"></c:set>
	<c:set var="imgRootURL" value="<%=imgRootURL %>"></c:set>
	<div class="wrap">
		<!---头部公共部分开始-->
		<div class="header">
			<div class="nav">
				<div class="nav_con">
					<div class="left">
						<p>欢迎来到景旭商城 &nbsp;&nbsp;<a href="${rootPath}/pc/index" style="color:#999;font-size:12px;">首页</a></p>
					</div>
					<div class="right">
						<ul id="nav">
							<shiro:guest>
							<li><a style="color:#999;text-decoration: none;" href="javascript:void(0)">您好，</a><a href="<%=basePath %>/home/loginPage">请登录</a></li>
							<li><a href="<%=basePath %>/reg/toRegPage" style="color: #dd2726">免费注册</a></li>
							</shiro:guest>
							<shiro:user>
							<li><a style="color:#999;text-decoration: none;" href="<%=basePath %>/pc/my">&nbsp;欢迎[<shiro:principal property="userName"/>]，</a><a href="<%=basePath %>/pc/logout">退出</a></li>
							</shiro:user>
							<li class="hasdrop"><a href="javascript: toMyOrder();">我的订单</a>
							<li><a href="#" onclick="javascript: toMyPage();">个人中心</a></li>
							<li><a href="#" onclick="javascript: toMyFavoritePage();">收藏中心</a></li>
							<li id="sign_li"><a href="#" onclick="javascript: doSign();">签到领积分</a></li>
							<li><span style="color: #cccccc; padding: 7px 50px; display: inline-block"></span></li>
							<li><a href="javascript:void(0)" id="purchasingHotline"></a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!---头部公共部分结束-->
	</div>
</body>
<script type="text/javascript">
$(function() {
	//采购热线
	$.ajax({
		type : "post",
		url :  "<%=basePath %>/dict/listKeyMapEntites?timesmap=" + new Date().getTime(),
		data: {keyType: 'purchasingHotline'},
		async : true,
		datatype : "json",
		success : function(json) {
			if (json.data.length > 0) {
				$('#purchasingHotline').html('采购热线：' + json.data[0].keyValue);
			}  
		}
	});
});
</script>
<script language="JavaScript" src="${rootPath}/statics/js/sme.base.js"></script>
<script type="text/javascript">
	function doSign() {
		$.ajax({
			type: 'POST',
			url: "<%=basePath %>/home/isLogin",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					$.ajax({
						type : "post",
						url : rootPath + '/home/doSign',
						async : false,
						datatype : "json",
						success : function(json) {
							if (json.code == '1') {
								layer.msg(json.msg, {icon:1});
							} else {
								layer.msg(json.msg, {
									time : 3000
								});
							}
						},
						error : function() {
							layer.msg('暂时无法签到', {
								time : 1000
							});
						}
					});
				} else {
					// layer.msg('请先登录！',{time:1000});
					window.location.href='<%=basePath %>/home/loginPage';
				}
			}
		});
	}
	/**
	 * 我的订单
	 */
	function toMyOrder() {
		$.ajax({
			type: 'POST',
			url: rootPath + "/home/isLogin",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					window.location.href = '<%=basePath %>/pc/order/list';
				} else {
					// layer.msg('请先登录！',{time:1000});
					window.location.href='<%=basePath %>/home/loginPage';
				}
			}
		});
	}
	/**
	 * 收藏中心
	 */
	function toMyFavoritePage() {
		$.ajax({
			type: 'POST',
			url: rootPath + "/home/isLogin",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					window.location.href='<%=basePath %>/pc/my/favorite';
				} else {
					// layer.msg('请先登录！',{time:1000});
					window.location.href='<%=basePath %>/home/loginPage';
				}
			}
		});
	}
	/**
	 * 个人中心
	 */
	function toMyPage() {
		$.ajax({
			type: 'POST',
			url: rootPath + "/home/isLogin",
			async: true,
			dataType: 'json',
			success: function(json) {
				if(json.code == '1') {
					window.location.href='<%=basePath %>/pc/my';
				} else {
					// layer.msg('请先登录！',{time:1000});
					window.location.href='<%=basePath %>/home/loginPage';
				}
			}
		});
	}
</script>
<html>
